﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using WordList;
using App1;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace WordsOfLove
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class wordPageSuccess : Page
    {
        vocNaviIntention currentStatus;//包含着当前单词书的id,名字，以及是否是复习模式，从navigate传参而来
        public wordPageSuccess()
        {
            this.InitializeComponent();
        }

        private void btnStartReview_Click(object sender, RoutedEventArgs e)//返回上一页
        {
            //Frame.GoBack();
            if (currentStatus.isReview == true)
            {
                Frame.Navigate(typeof(WordPage), currentStatus);
            }
            else
            {
                Frame.Navigate(typeof(wordPageWelcome), currentStatus);
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)//页面跳转过来的时候调用的函数
        {
            if (e.Parameter.GetType().Equals(typeof(vocNaviIntention)))//在这里获得单词书编号，开始加载wordList
            {
                currentStatus = (vocNaviIntention)e.Parameter;
                vocBookName.Text = currentStatus.vocBook.bookName;//加载名字
                if (currentStatus.isReview == false)//如果复习完，按钮功能改为返回
                {
                    btnStartReview.Content = "返回";
                }
            }
            else
            {
                Debug.WriteLine("Navigated to Voc page without vocBook Para, please check the invoke funcs");
            }

        }
    }
}
